package org.pjlib.net;

import com.blankj.utilcode.util.ObjectUtils;
import com.blankj.utilcode.util.ToastUtils;

/**
 * Created by ws on 2019/05/22.
 */
public abstract class CallBack implements JsonCallBack {
    Object tag;

    public CallBack() {
    }

    public CallBack(Object tag) {
        this.tag = tag;
    }

    @Override
    public void onBeforeRequest(RequestCall call) {

    }

    @Override
    public void onResponseError(Throwable t, RequestCall call) {
        ToastUtils.showShort(MyException.NO_AVAILABLE_NETWORK);
    }

    @Override
    public void onResponseSuccess(RequestCall call) {

    }

    @Override
    public void onFinishRequest(RequestCall call) {

    }

    @Override
    public Object getNetTag() {
        if(ObjectUtils.isEmpty(tag)){
            return this;
        }else
        return tag;
    }
}
